package actions;

import jason.asSemantics.DefaultInternalAction;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.NumberTermImpl;
import jason.asSyntax.Term;

@SuppressWarnings("serial")
public class unknown_cell extends DefaultInternalAction{

	@Override
	public Object execute(TransitionSystem ts, Unifier un, Term[] args)
			throws Exception {
		
//		Term x = args[0];
//		Term y = args[1];
		Term uX = args[2];
		Term uY = args[3];
		
//		String direcao = "";
		
		// Unfold terms
		//double vx = ((NumberTerm)x).solve();
		//double vy = ((NumberTerm)y).solve();
		//double vux = ((NumberTerm)uX).solve();
		//double vuy = ((NumberTerm)uY).solve();
		
//		EcompArch arch = (EcompArch)ts.getUserAgArch();
//		LocalWorldModel model = arch.getLocalWorldModel();
		//... PEGAR A CELULA DESCONHECIDA MAIS LONGE DOS ALIADOS...

//		Random r = new Random();
//		int nextInt = r.nextInt(8);
//		Direction direc = Direction.NORTH;
//		switch(nextInt){
//		case 0:
//			direc = Direction.NORTH;
//			break;
//		case 1:
//			direc = Direction.SOUTH;
//			break;
//		case 2:
//			direc = Direction.WEST;
//			break;
//		case 3:
//			direc = Direction.EAST;
//			break;
//		case 4:
//			direc = Direction.NORTHEAST;
//			break;
//		case 5:
//			direc = Direction.NORTHWEST;
//			break;
//		case 6:
//			direc = Direction.SOUTHEAST;
//			break;
//		case 7:
//			direc = Direction.SOUTHWEST;
//			break;
//		}
		/*double vNewX = r.nextBoolean() ? (vx + nextInt) : (vx - nextInt);
		nextInt = r.nextInt(2);
		double vNewY = r.nextBoolean() ? (vy + nextInt) : (vy - nextInt);
		// Update output terms
		un.unifies(newX, new NumberTermImpl(vNewX));
		un.unifies(newY, new NumberTermImpl(vNewY));*/
		// everything ok, so returns true
		Thread.sleep(50);
		un.unifies(uX, new NumberTermImpl(20.0));
		un.unifies(uY, new NumberTermImpl(20.0));
		return true;
	}

}
